Web Design Stuff
HTML Tutorials    CSS Tutorials    Web Hosting   Resources
Create a Web Page 101
Making Web Pages Intro What is a Web Page? Why Make a Web Page? The History of HTML Learn HTML or XHTML?
Basic HTML
Basic HTML Tutorials Basic HTML Necessities How to Make a Web Page How to Edit a Web Page The Basics of HTML Tags Basic HTML Page Structure HTML Attributes
HTML Font Codes
HTML Font Codes Intro HTML Font Color Codes HTML Font Size Codes HTML Font Style Codes HTML Bold/Italic Codes Combining Font Codes
Formatting Text
Formatting Text Intro Making Paragraphs Miscellaneous Formatting Headings & Subheadings Creating Hyperlinks
Using Graphics
Using Graphics on the Web Add Graphics to Your Pages Graphics and Accessibility How to Align Graphics Page Color & Background Graphics as Hyperlinks Horizontal Rules
Creating Tables
HTML Tables Tutorials HTML Table Fundamentals Background & Border Color Table Frames & Rules Table Width and Alignment Cells 1 -Space & Alignment Cells 2 -Row Column Span Cells 3 -Width & Height
Making Lists
HTML Lists Tutorials Bulleted Lists Numbered Lists Definition Lists
HTML Frames
HTML Frames Tutorials Using Frames for Layout Advanced Frame Layouts Putting Hyperlinks in Frames Frame Border Width Color, Margin and Control Problems with Frames SmartFrames: A Solution SSI: An Alternative to Frames
Web Page Forms
Making Feedback Forms A Simple Feedback Form Installing NMS FormMail Debugging Your Setup My Web Host is Out to Lunch User Input Components Text Fields Checkboxes & Radio Buttons Dropdown Menus Push Buttons Layout and Presentation
Basic CSS
Basic CSS Tutorials What is CSS? Why You Should Use CSS How to Use CSS Inline Styles Embedded Style Sheets External Style Sheets Class Selectors ID Selectors Combining Selectors
CSS Properties
CSS Properties Intro Font Styles Width, Height & Spacing Borders Backgrounds Position Float & Alignment Hyperlinks
All About Web Hosting
Hosting Your Own Website What is a Web Host? Your Website's Home Page Building a Website Offline About Free Web Hosting Best Free Web Hosting Commercial Web Hosting How to Get a Domain Name Ecommerce Web Hosting Web Hosting Terminology
Free Web Design Tools
Best Free Website Tools Best Free Text Editors Best Free Graphics Editors Free Website Analysis Tools
Setting Up HTML Kit
HTML Kit Introduction How to install HTML Kit Screenshot Breakdown Basic Configuration Overall Appearance Shortcuts and Startup Editing Window Customizing Toolbars Using the Favorites Tab Making a New Actions Bar Odds and Ends
Free Templates
Free Website Templates Two Column Fixed Width Three Column Liquid Layout Miscellaneous Templates Dynamic Menu Effects Two Column Experimental Terms of Use About These Templates
Website Templates Help
Getting Started Template Zip File Download How to Edit Your Template What to Edit in the HTML How to Add Your Logo Making a Website
Web Design Tips
Web Design Basics Tables vs. Tableless Using Tables for Layout Example Table Layouts World's Crappiest Web Page
Twitter Backgrounds
Twitter Backgrounds Intro Cool Twitter Backgrounds Cool Twitter Backgrounds 2 Plain Twitter Backgrounds Dark Twitter Backgrounds Best Twitter Backgrounds Cute Twitter Backgrounds Music Twitter Backgrounds Music Twitter Backgrounds 2 Twitter Backgrounds 101 TERMS OF USE
All About Web Browsers
What is a Web Browser? Mozilla Firefox Internet Explorer Opera How to Set Up Firefox Top 5 Firefox Extensions
 
Contact
Post Some Feedback Send Me An Email Iron Spider Blog About Iron Spider... Site Conventions
 
 
 

 

Graphics as Hyperlinks

 
<a href="valid web address">
<img src="graphic file name">
</a>
Now that you know how to insert graphics on your web page and how to create hyperlinks, let's put the two together to display graphics that act as hyperlinks. Some common uses for this are:
  • Linking to the website's home page via a graphical heading or logo appearing at the top of each web page.
  • Linking to the next page, previous page or the top of the current page via 'buttonized' navigational links at the bottom of each page.
  • Linking to all the pages in a website via buttons in an index or menu.
  • Linking to large full-sized graphics via thumbnail or miniaturized versions.
To display any graphic as a hyperlink, simply replace the link text which usually acts as the hyperlink content with an <img> tag (loaded with the appropriate attributes, of course).

For example, here's the source code to produce a link to the Iron Spider home page using the old Iron Spider logo:

Example 1A - SOURCE CODE

<center>
<a href="http://www.ironspider.ca/">
   <img src="irnspd97.jpg"></a>
</center>



Example 1B - RESULT
Iron Spider logo



Link Borders


So you don't want that colored border that appears around graphic links or, conversely, you want to make it bigger?

No problem!

First of all, by way of explanation, most web browsers by default will display a border around graphic links indicating the link status color. If you don't want this border to appear or you actually want to make it bigger, you can do so using the border attribute in your <img> tag. The value for the border attribute represents the link border width in pixels where the default is usually "2". To make the border disappear altogether, put a value of "0". To make the border bigger put any value bigger than 2 (or for a thin subtle border put a value of "1"). Examples:

Example 2A - SOURCE CODE

<center>
<a href="http://www.ironspider.ca/">
    <img src="irnspd97.jpg" border="0"></a>
</center>



Example 2B - RESULT (no border)
Iron Spider logo


Example 3A - SOURCE CODE

<center>
<a href="http://www.ironspider.ca/">
    <img src="irnspd97.jpg" border="5"></a>
</center>



Example 3B - RESULT (5 pixel border width)
Iron Spider logo



Displaying Tool Tips


You should keep in mind however that the link border does actually serve a purpose and that is to indicate to the viewer that this image is indeed a link. In some instances, such as when the image is 'buttonized' (shaped like a button) it will be obvious the image is a link. In other instances, however, whether the image represents a link or not will be less obvious.

How to display graphics as links is largely a matter of taste but regardless of what style you choose, you will probably want to convey to viewers some kind of text to indicate where your graphic link leads to. Some web authors depend on the alt attribute in the <img> tag to pick up the slack on this task since setting the alternate text will also display a tool tip when the viewer hovers their mouse pointer over the graphic. However this is only reliable in Internet Explorer and older versions of Netscape. Moreover, the alt attribute is really intended to address accessibility issues or those who have set their browsers to not display graphics.

Instead of depending on the alt attribute to convey this information, it's much more reliable to also insert the title attribute in your <img> tag. This will display a little pop-up advisory text (more commonly known as a 'tool tip') when a mouse pointer hovers over the link graphic regardless of the browser that is being used. To illustrate, the following source code will display 'Go to Iron Spider home page' as a tool tip when the viewer hovers their mouse pointer over the Iron Spider logo link:

Example 4A - SOURCE CODE

<center>
<a href="http://www.ironspider.ca/">
<img src="irnspd97.jpg" title="Go to Iron Spider home page">
</a>
</center>



Example 4B - RESULT (graphic link with tool tip)
Iron Spider


(Note that when using both the alt attribute and the title attribute in the <img> tag, the resulting tool tip displayed in Internet Explorer will be the value of the title attribute.)


Graphics are commonly used as 'dividers' which decoratively separate your web pages into sections. There is, however, a way to use HTML to display a simple but highly configurable graphic divider known as the horizontal rule...





Best Free Stuff
for webmasters

Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates

See also:

Best Free Web Hosting

 

If you need a .COM web address, you can get one quick and easy at...

www.GoDaddy.com
<~BACK TOP NEXT~>
 
HTML Tutorials |  CSS Tutorials |  Web Hosting |  Domain Names |  Web Design Resources
Iron Spider © Copyright 2004-2011 Robert Darrell